abstract class Shape{
    private String color;
    public Shape(String color) {
        this.color = color;
    }
    public abstract void celPerimeter();
}
class Triangle extends Shape{
    double l1;
    double l2;
    double l3;
    public Triangle(String color, double l1, double l2, double l3) {
        super(color);
        this.l1 = l1;
        this.l2 = l2;
        this.l3 = l3;
        System.out.println("三角形颜色为"+color);
    }
    @Override
    public void celPerimeter() {
        //先判断三角形成不成立
        if(l1+l2>l3 && l1+l3>l2 && l2+l3>l1){
            System.out.println("两边之和大于第三边,三角形成立,周长为 "+ (l1+l2+l3));
        }else {
            System.out.println("三角形不成立");
        }
    }
}
class Circle extends Shape{
    double radius;
    public Circle(String color, double radius) {
        super(color);
        this.radius = radius;
        System.out.println("圆圈颜色为"+color);
    }
    @Override
    public void celPerimeter() {
        System.out.println("周长为"+2*radius+"π");
    }
}
public class Test {
    public static void main(String[] args) {
        Shape shape = new Triangle("红色",3,6,7);
        shape.celPerimeter();
        Shape shape1 = new Circle("蓝色",3);
        shape1.celPerimeter();
    }
}
